package com.bleeth.fx.component;

import com.bleeth.fx.helper.SStyleHelper;
import com.bleeth.fx.helper.ThemeTypeEnum;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import lombok.Builder;


/**
 * @author Sakura
 * @version 1.0
 * @date 2021-11-13 22:17
 **/
@Builder
public class MInputNumber {


    private Integer step;

    public HBox make() {
        Button left = MButton.builder().width(40).icon("icon-minus").build().make();
        Button right = MButton.builder().width(40).icon("icon-plus").build().make();
        TextField input = new TextField();
        input.setPrefHeight(40);
        input.setPrefSize(100, 40);
        input.setAlignment(Pos.CENTER);

        HBox hBox = new HBox();
        hBox.getChildren().addAll(left, input, right);

        SStyleHelper.node(left)
                .addStyle("-fx-background-color", "#d9dadc" + "55")
                .addStyle("-fx-border-width","1")
                .addStyle("-fx-border-color",ThemeTypeEnum.BLACK_COLOR.getValue() + "33")
                .addStyle("-fx-border-radius", "5 0 0 5")
                .apply();

        SStyleHelper.node(right)
                .addStyle("-fx-background-color", "#d9dadc" + "55")
                .addStyle("-fx-border-width","1")
                .addStyle("-fx-border-color",ThemeTypeEnum.BLACK_COLOR.getValue() + "33")
                .addStyle("-fx-border-radius", "0 5 5 0")
                .apply();


        SStyleHelper.node(input)
                .addStyle("-fx-background-color","-fx-control-inner-background")
                .addStyle("-fx-background-insets","0")
                .addStyle("-fx-padding","1 3 1 3")
                .addStyle("-fx-border-width", "1 0 1 0")
                .addStyle("-fx-border-color", ThemeTypeEnum.BLACK_COLOR.getValue() + "33")
                .apply();

        SStyleHelper.node(hBox)
                .addStyle("-fx-border-width", "0")
                .addFocusStyle("-fx-border-width", "1")
                .addFocusStyle("-fx-border-color", ThemeTypeEnum.PRIMARY_COLOR.getValue() + "33")
                .addFocusStyle("-fx-border-radius",  "5 5 5 5")
                .apply();



        return hBox;
    }


}
